import request from '@/utils/request'
import { getToken } from '@/utils/auth'

/**
 * 查询发票数据列表
 */
export function getInvoiceList(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/settle/invoice/getInvoiceList',
    method: 'get',
    params: query
  })
}

/**
 * 查询发票详情
 */
export function getInvoice(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/settle/invoice/getInvoice',
    method: 'get',
    params: query
  })
}

/**
 * 删除发票数据
 */
export function removeInvoice(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/settle/invoice/removeInvoice',
    method: 'get',
    params: query
  })
}

/**
 * 保存发票数据
 */
export function saveInvoice(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/settle/invoice/saveInvoice',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

/**
 * 导出发票数据
 */
export function exportInvoice(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/settle/invoice/exportInvoice',
    method: 'post',
    responseType: 'blob',
    data
  })
}
